package com.springcloud.yishop.controller;

import com.springcloud.yishop.service.DeptClientService;
import com.yishop.pojo.Dept;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class DeptConsumerController {

   // @Qualifier("SPRINGCLOUD-PROVIDER-YISHOP")
    @Autowired(required = false)
    private DeptClientService Service =null;
    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){
       return  this.Service.queryById(id);
}
    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept){
       return this.Service.addDept(dept);
    }
    @RequestMapping("/consumer/dept/list")
    public List<Dept> list(){
    return  this.Service.query();
    }

}
